module CommentsHelper

  def comment_list(posts)
    ret = '<p>'
    posts.each do |un_post|
      ret << "(#{un_post.created_at.getlocal.to_formatted_s(:db)})&nbsp;"+link_to(un_post.user.nickname,user_medias_url(un_post.user))
      ret << '>'+link_to(un_post.media.nom, media_path(un_post.media)) if un_post.media
      ret << ":&nbsp;#{sanitize(un_post.msg, :tags => %w(strong b i ul li table tr td tbody br))}<br/>"
    end
    return ret << '</p>'
  end

    def comment_list_by_media(posts)
    ret = '<p>'
    posts.each do |un_post|
      ret << "(#{un_post.created_at.getlocal.to_formatted_s(:db)})&nbsp;"+link_to(un_post.user.nickname,user_medias_url(un_post.user))+":&nbsp;#{sanitize(un_post.msg, :tags => %w(strong b i ul li table tr td tbody br))}<br/>"
    end
    return ret << '</p>'
  end
end
